<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import {
  BookOutlined,
  ClockCircleOutlined,
  StarOutlined,
  UserOutlined,
  RobotOutlined
} from '@ant-design/icons-vue'
import { getCourseCategoryIndex } from '@/api/bizCourseCategoryController'
import GlobalHeader from '@/components/layout/GlobalHeader.vue'
import { getCoursePageList } from '@/api/bizCoursesBaseController.ts'
import noteImg1 from '@/assets/note.png'
import noteImg2 from '@/assets/note2.png'
import aiImg from '@/assets/AI.png'

const router = useRouter()
// 课程分类数据
const categoryTree = ref<any[]>([])
const firstLevelTabs = ref<any[]>([])
const selectedTabKey = ref<string | number>('')

// 轮播图ref和弹框定位
const bannerRef = ref<HTMLElement | null>(null)
const popoverFixedPosition = ref({ top: 0, left: 0, width: 640, height: 340 })

function updatePopoverPosition() {
  if (bannerRef.value) {
    const rect = bannerRef.value.getBoundingClientRect()
    popoverFixedPosition.value = {
      top: rect.top + window.scrollY - 24,
      left: rect.left + window.scrollX,
      width: rect.width,
      height: rect.height
    }
  }
}

onMounted(() => {
  updatePopoverPosition()
  window.addEventListener('resize', updatePopoverPosition)
})
onBeforeUnmount(() => {
  window.removeEventListener('resize', updatePopoverPosition)
})

// 监听categoryTree变化，自动生成一级tab
watch(
  categoryTree,
  (val) => {
    if (Array.isArray(val) && val.length > 0) {
      firstLevelTabs.value = val.map(item => ({ id: item.id, name: item.name, children: item.children }))
      // 默认选中第一个tab
      selectedTabKey.value = val[0].id
    }
  },
  { immediate: true }
)

// 获取当前tab下的一级菜单
const currentTabChildren = computed(() => {
  const tab = categoryTree.value.find(item => item.id === selectedTabKey.value)
  return tab?.children || []
})

// 弹框悬浮逻辑
const hoverMenuIndex = ref<number | null>(null)
const showPopover = ref(false)
const popoverPosition = ref({ top: 0, left: 0 })
const popoverData = ref<any>(null)
const popoverMenuId = ref<number | null>(null)
let hidePopoverTimer: ReturnType<typeof setTimeout> | null = null

function onMenuMouseEnter(index: number, event: MouseEvent, menu: any) {
  if (hidePopoverTimer) {
    clearTimeout(hidePopoverTimer)
    hidePopoverTimer = null
  }
  if (menu.children && menu.children.length > 0) {
    hoverMenuIndex.value = index
    showPopover.value = true
    popoverData.value = menu.children
    popoverMenuId.value = menu.id
    // 计算弹框位置
    const target = event.currentTarget as HTMLElement
    const rect = target.getBoundingClientRect()
    popoverPosition.value = {
      top: rect.top + window.scrollY,
      left: rect.right + 12 + window.scrollX
    }
  } else {
    // 没有children时立即关闭弹框
    showPopover.value = false
    hoverMenuIndex.value = null
    popoverData.value = null
    popoverMenuId.value = null
  }
}

function onMenuMouseLeave(e: MouseEvent) {
  hidePopoverTimer = setTimeout(() => {
    if (!popoverHovering.value) {
      showPopover.value = false
      hoverMenuIndex.value = null
      popoverData.value = null
      popoverMenuId.value = null
    }
  }, 120)
}

const popoverHovering = ref(false)

function onPopoverEnter() {
  popoverHovering.value = true
}

function onPopoverLeave() {
  popoverHovering.value = false
  showPopover.value = false
  hoverMenuIndex.value = null
  popoverData.value = null
  popoverMenuId.value = null
}

function goToCourse(id: number) {
  if (userInfo.value == null) {
    message.warn("请先登录")
  }
  router.push(`/course/learn/${id}`)
}

const userInfo = ref<any>(null)

// 检查用户登录状态
const checkUserLogin = () => {
  const storedUserInfo = localStorage.getItem('userInfo');
  const token = localStorage.getItem('token');
  
  if (storedUserInfo && token) {
    try {
      userInfo.value = JSON.parse(storedUserInfo);
      // 可以在这里添加token有效性检查
    } catch (e) {
      localStorage.removeItem('userInfo');
      localStorage.removeItem('token');
    }
  }
};
// 页面加载时检查登录状态
onMounted(() => {
checkUserLogin();
});



onMounted(async () => {
  const res = await getCourseCategoryIndex()
  const { code, data } = res.data || {}
  console.log(data)
  if (code === 0 && Array.isArray(data)) {
    categoryTree.value = data
    // console.log('------', firstLevelTabs.value)
  }
})

// 轮播图数据
const banners = ref([])

onMounted(async () => {
  //获取轮播图数据
  const params = {
    coursePageListDto: {
      current: 1,
      pageSize: 10,
      categoryId: 20 //todo 写死,java分类的轮播图。后续能通过管理员配置
    }
  }
  const res = await getCoursePageList(params)
  if (res.data.code == 0 && res.data.data) {
    console.log(res.data)
    banners.value = res.data.data.list?.map(item => {
      return {
        id: item.id,
        title: item.title,
        coverUrl: import.meta.env.VITE_PIC_BASE_URL + item.coverUrl,
        url: '/course/learn/' + item.id
      }
    })
  } else {
    console.log('轮播图课程获取失败')
  }
})

// 笔记功能图片轮播
const noteImages = [noteImg1, noteImg2]
const currentImg = ref(0)

// 优化图片切换：只用v-show+transition，不销毁img节点
// 鼠标滚轮切换图片，未到边界阻止页面滚动
function onImgWheel(e: WheelEvent) {
  let handled = false
  if (e.deltaY > 0) {
    // 向下滚动，下一张
    if (currentImg.value < noteImages.length - 1) {
      currentImg.value++
      handled = true
    }
  } else if (e.deltaY < 0) {
    // 向上滚动，上一张
    if (currentImg.value > 0) {
      currentImg.value--
      handled = true
    }
  }
  if (handled) {
    e.preventDefault()
  }
}

// 搜索框回调
function handleMainSearch(v: string) {
  if (!v.trim()) return
  router.push({ path: '/ai-chat', query: { q: v } })
}

// 搜索框回车事件，修复类型
function onMainSearchPressEnter(e: KeyboardEvent) {
  const value = (e.target as HTMLInputElement).value
  handleMainSearch(value)
}

// 动态问候语
function getGreeting() {
  const hour = new Date().getHours()
  if (hour < 11) return '早上好，有什么我能帮你的吗？'
  if (hour < 14) return '中午好，有什么我能帮你的吗？'
  if (hour < 18) return '下午好，有什么我能帮你的吗？'
  return '晚上好，有什么我能帮你的吗？'
}

</script>

<template>
  <a-layout class="home-container">
    <!-- 顶部导航栏 -->
    <div class="fixed-header-wrapper">
      <global-header />
    </div>
    <div v-if="userInfo" class="main-search-block">
      <div class="main-search-title">{{ getGreeting() }}</div>
      <a-input
        class="main-search-input"
        :style="{ height: '60px', borderRadius: '36px' }"
        size="large"
        placeholder="搜索，提问或发消息"
        @pressEnter="onMainSearchPressEnter"
      />
      <div class="main-search-actions">
        <a-button type="default" size="large" class="main-search-action-btn" @click="router.push('/ai-chat')">
          <span class="main-search-action-icon"><component :is="RobotOutlined" /></span>AI聊天
        </a-button>
        <a-button type="default" size="large" class="main-search-action-btn" @click="router.push('/user/teams')">
          <span class="main-search-action-icon"><component :is="UserOutlined" /></span>个人中心
        </a-button>
        <a-button type="default" size="large" class="main-search-action-btn" @click="router.push('/TeamLearningPlatform')">
          <span class="main-search-action-icon"><component :is="BookOutlined" /></span>组队学习
        </a-button>
<!--        <a-button type="default" size="large" class="main-search-action-btn" @click="router.push('/team')">-->
<!--          <span class="main-search-action-icon"><component :is="StarOutlined" /></span>我的战队-->
<!--        </a-button>-->
        <a-button type="default" size="large" class="main-search-action-btn" @click="router.push('/user/notes')">
          <span class="main-search-action-icon"><component :is="BookOutlined" /></span>我的笔记
        </a-button>

      </div>
    </div>
    <!-- 首页竖直菜单+轮播图 -->
    <div class="home-banner-row">
      <div class="home-banner-container">
        <!-- 左侧tabs+右侧一级菜单 -->
        <div class="home-category-menu-vertical">
          <div class="category-tabs-tree-wrapper">
            <a-tabs
              v-model:activeKey="selectedTabKey"
              tab-position="left"
              class="vertical-tabs"
            >
              <a-tab-pane
                v-for="tab in firstLevelTabs"
                :key="tab.id"
                :tab="tab.name"
                class="vertical-tab-pane"
              />
            </a-tabs>
            <div class="vertical-menu-list">
              <div
                v-for="(menu, idx) in currentTabChildren"
                :key="menu.id"
                class="vertical-menu-item"
                @mouseenter="(e) => onMenuMouseEnter(idx, e, menu)"
                @mouseleave="onMenuMouseLeave"
              >
                <span class="menu-title">{{ menu.name }}</span>
              </div>
            </div>
            <!-- 悬浮弹框：固定在轮播图区域 -->
            <teleport to="body">
              <div
                v-if="showPopover && popoverData && popoverMenuId !== null"
                class="custom-popover popover-fixed"
                :style="{
                  top: popoverFixedPosition.top + 'px',
                  left: popoverFixedPosition.left + 'px',
                  width: popoverFixedPosition.width + 'px',
                  height: popoverFixedPosition.height + 'px'
                }"
                @mouseenter="onPopoverEnter"
                @mouseleave="onPopoverLeave"
              >
                <div class="popover-content">
                  <div
                    v-for="child in popoverData"
                    :key="child.id"
                    class="popover-submenu"
                  >
                    <div class="submenu-title">{{ child.name }}</div>
                    <ul v-if="child.courses && child.courses.length" class="submenu-course-list">
                      <li
                        v-for="course in child.courses"
                        :key="course.id"
                        class="submenu-course-item"
                        @click="goToCourse(course.id)"
                      >
                        {{ course.title }}
                      </li>
                    </ul>
                    <div v-else class="no-course">暂无课程</div>
                  </div>
                </div>
              </div>
            </teleport>
          </div>
        </div>
        <!-- 右侧轮播图 -->
        <div class="home-banner-carousel" ref="bannerRef">
          <a-carousel autoplay>
            <div v-for="banner in banners" :key="banner.id">
              <router-link :to="banner.url">
                <img :src="banner.coverUrl" :alt="banner.title" class="banner-image" />
              </router-link>
            </div>
          </a-carousel>
        </div>
      </div>
    </div>
    <div v-if="!userInfo">
      <!-- AI文档介绍板块（新版，深色风格，图片在左） -->
      <div class="ai-doc-intro-section-v2 full-width-block">
        <div class="ai-doc-intro-content-v2">
          <div class="ai-doc-intro-img-v2">
            <img :src="aiImg" alt="AI文档智能总结" />
          </div>
          <div class="ai-doc-intro-text-v2">
            <h2>AI智能文档 · 自动总结</h2>
            <p class="ai-doc-intro-desc-v2">
              利用前沿AI技术，平台可自动分析课程视频内容，智能生成结构化学习文档，帮你高效梳理知识脉络，节省整理时间，提升学习效率。
            </p>
            <ul class="ai-doc-intro-list-v2">
              <li><span class="icon">⚡</span> 一键生成，自动归纳重点难点</li>
              <li><span class="icon">🧠</span> AI理解上下文，逻辑清晰</li>
              <li><span class="icon">📄</span> 支持导出PDF/Markdown等多格式</li>
              <li><span class="icon">🔗</span> 可与个人笔记无缝结合</li>
            </ul>
          </div>
        </div>
      </div>
      <!-- 组队学习板块 -->
      <div class="team-learning-section full-width-block">
        <div class="team-learning-content">
          <div class="ai-doc-intro-img-v2">
            <img src="https://picsum.photos/id/1003/40/40" alt="AI文档智能总结" />
          </div>
          <div class="team-learning-text">
            <h2>组队学习 · 共同进步</h2>
            <p class="team-learning-desc">
              邀请好友组队学习，互相监督、共同进步。参与组队任务，解锁专属勋章，体验更有动力的学习之旅！
            </p>
            <ul class="team-learning-list">
              <li>组队打卡，互相激励</li>
              <li>团队任务，协作成长</li>
              <li>专属勋章，荣誉加持</li>
              <li>实时排行，见证进步</li>
            </ul>
            <a-button type="primary" size="large" style="margin-top: 18px;" @click="router.push('/teamLearning')">
              立即前往组队学习
            </a-button>
          </div>
        </div>
      </div>
      <!-- 新增笔记功能介绍模块，仅未登录用户可见，与轮播图同级，宽度一致 -->
      <div v-if="!userInfo" class="note-intro-section full-width-block">
        <div class="note-intro-content">
          <div class="note-intro-left">
            <h2>学习笔记功能</h2>
            <p class="note-intro-desc">
              注册后即可使用在线笔记功能，随时记录学习心得、重点难点，支持Markdown格式，自动同步，助力高效学习。</p>
            <ul class="note-intro-list">
              <li>随时随地记录学习内容</li>
              <li>支持Markdown，格式丰富</li>
              <li>可关联课程、章节，查找更方便</li>
              <li>也可创造个人笔记，个性总结知识</li>
            </ul>
          </div>
          <div class="note-intro-right"
               @wheel="onImgWheel"
          >
            <div class="img-switcher">
              <transition name="fade-img">
                <img
                  :src="noteImages[currentImg]"
                  :key="currentImg"
                  alt="笔记功能"
                  class="switch-img"
                />
              </transition>
            </div>
            <div class="img-dots-vertical">
             <span
               v-for="(img, idx) in noteImages"
               :key="idx"
               :class="['dot', { active: idx === currentImg }]"
               @click="currentImg = idx"
             ></span>
            </div>
          </div>
        </div>
      </div>

      <!-- 新增系统相关内容区块，与轮播图同级，宽度一致 -->
      <div class="system-info-section full-width-block">
        <div class="system-info-content">
          <!-- 平台简介 -->
          <div class="system-info-block">
            <div class="sysinfo-icon-block blue">
              <component :is="BookOutlined" />
            </div>
            <h2>平台简介</h2>
            <p class="system-info-desc">
              AI在线课堂平台致力于为广大用户提供优质的AI与编程课程，支持智能推荐、AI助手答疑、个性化学习路径等功能，助力每一位学习者高效成长。</p>
          </div>
          <!-- 数据统计 -->
          <div class="system-info-block">
            <div class="sysinfo-icon-block green">
              <component :is="UserOutlined" />
            </div>
            <h2>平台数据</h2>
            <ul class="system-info-list">
              <li><span class="sysinfo-li-icon"><component :is="BookOutlined" /></span>课程总数：<span
                class="system-info-highlight">120+</span></li>
              <li><span class="sysinfo-li-icon"><component :is="UserOutlined" /></span>注册用户：<span
                class="system-info-highlight green">8,000+</span></li>
              <li><span class="sysinfo-li-icon"><component :is="ClockCircleOutlined" /></span>累计学习时长：<span
                class="system-info-highlight orange">30,000+ 小时</span></li>
            </ul>
          </div>
          <!-- 平台特色 -->
          <div class="system-info-block">
            <div class="sysinfo-icon-block orange">
              <component :is="StarOutlined" />
            </div>
            <h2>平台特色</h2>
            <ul class="system-info-list disc">
              <li><span class="sysinfo-li-icon"><component :is="StarOutlined" /></span>AI智能推荐学习内容</li>
              <li><span class="sysinfo-li-icon"><component :is="StarOutlined" /></span>丰富的实战项目课程</li>
              <li><span class="sysinfo-li-icon"><component :is="StarOutlined" /></span>AI助手7x24答疑</li>
              <li><span class="sysinfo-li-icon"><component :is="StarOutlined" /></span>多端同步学习进度</li>
            </ul>
          </div>
        </div>
      </div>

      <!-- AI课堂之旅引导区块 -->
      <div class="footer-cta-block">
        <div class="footer-cta-content">
          <div class="footer-cta-title">开启你的AI课堂之旅</div>
          <div class="footer-cta-actions">
            <a-button type="primary" size="large" @click="router.push('/login')">登录</a-button>
            <span class="footer-cta-register-row">
          <span class="footer-cta-divider">没有账号？</span>
          <a-button type="link" size="large" @click="router.push('/register')">立即注册</a-button>
        </span>
          </div>
        </div>
      </div>
    </div>

  </a-layout>


  <!-- 页脚系统信息区块 -->
  <footer class="site-footer">
    <div class="footer-content">
      <div class="footer-main">
        <div class="footer-logo-title">
          <span class="footer-logo">蜗牛AI在线课堂</span>
        </div>
        <div class="footer-links">
          <span>联系方式：support@snailai.com</span>
          <span class="footer-divider">|</span>
          <span>客服电话：400-123-4567</span>
          <span class="footer-divider">|</span>
          <span>技术支持：蜗牛AI团队</span>
        </div>
        <div class="footer-icp">
          <span>蜗牛AI科技有限公司 版权所有 © 2024</span>
          <span class="footer-divider">|</span>
          <a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener"
             class="footer-link">粤ICP备2024000001号-1</a>
          <span class="footer-divider">|</span>
          <a href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030502000001" target="_blank"
             rel="noopener" class="footer-link">
            <img src="https://www.beian.gov.cn/img/ghs.png" alt="公安备案"
                 style="height: 16px;vertical-align: middle;margin-right: 2px;" />粤公网安备 44030502000001号
          </a>
        </div>
      </div>
    </div>
  </footer>
</template>


<style scoped>
.home-container {
  min-height: 100vh;
  /* 让内容不被fixed header遮挡 */
  padding-top: 64px;
}

.fixed-header-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: #1890ff;
}

.header-right {
  display: flex;
  gap: 12px;
}

.content {
  padding: 24px;
  background: #fff;
}

.home-menu-bar {
  background: #fff;
  padding: 0 24px;
  margin-bottom: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ant-menu-horizontal {
  border-bottom: none;
  font-size: 16px;
  min-height: 48px;
}

.home-main-row {
  margin: 32px 0;
}

.banner-section {
  margin-bottom: 0;
}

.banner-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  display: block;
  margin-bottom: 32px;
}

.home-banner-row {
  width: 100%;
  background: linear-gradient(360deg, #eaf3ff 0%, #fff 100%);
  padding: 48px 0 32px 0;
  margin-bottom: 36px;
}

.home-banner-container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 320px;
  border-radius: 18px;
  box-shadow: 0 4px 24px 0 rgba(91, 140, 250, 0.08);
  background: #fff;
  padding: 0 0 0 0;
}

.home-category-menu-vertical {
  width: 260px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-right: 24px;
  padding: 0;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.category-tabs-tree-wrapper {
  display: flex;
  flex-direction: row;
  height: 100%;
}

.vertical-tabs {
  min-width: 90px;
  width: 90px;
  border-right: 1px solid #f0f0f0;
  background: #fafbfc;
  height: 100%;
}

.vertical-tab-pane {
  padding: 0;
}

.vertical-tree-wrapper {
  flex: 1;
  padding: 16px 8px 16px 16px;
  overflow-y: auto;
}

.home-banner-carousel {
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
}

.banner-image {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 2px 16px 0 rgba(91, 140, 250, 0.10);
  transition: transform 0.35s cubic-bezier(.4, 1.6, .6, 1), box-shadow 0.35s, filter 0.35s;
  cursor: pointer;
}

.banner-image:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 36px 0 rgba(91, 140, 250, 0.18);
  filter: brightness(1.04);
}

.tree-course-list {
  margin: 4px 0 0 16px;
  padding: 0;
  list-style: disc;
  color: #888;
  font-size: 13px;
}

.tree-course-item {
  margin: 0 0 2px 0;
  padding: 0;
}

.submenu-panel {
  display: flex;
  gap: 32px;
  padding: 16px 32px;
  background: #fff;
  min-width: 480px;
}

.submenu-col {
  min-width: 120px;
}

.submenu-col-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #222;
}

.submenu-course-list {
  margin: 0 0 8px 0;
  padding: 0;
  list-style: disc;
  color: #888;
  font-size: 13px;
}

.submenu-course-item {
  margin: 0 0 2px 0;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s;
}

.submenu-course-item:hover {
  color: #1890ff;
}

.submenu-subcat {
  margin-top: 8px;
}

.vertical-menu-list {
  flex: 1;
  padding: 16px 8px 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vertical-menu-item {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  color: #222;
  background: #f7f9fa;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  position: relative;
}

.vertical-menu-item:hover {
  background: #e6f0ff;
  color: #1890ff;
}

.menu-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-fixed {
  position: fixed !important;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.custom-popover {
  /* 由.popover-fixed控制定位和尺寸 */
  z-index: 9999;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  border-radius: 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  backdrop-filter: blur(12px) saturate(1.2);
  animation: popover-fade-in 0.18s;
  overflow: hidden;
}

@keyframes popover-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.popover-content {
  display: flex;
  flex-wrap: wrap;
  gap: 40px 56px;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.popover-submenu {
  min-width: 160px;
  max-width: 220px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 18px 18px 12px 18px;
  margin-bottom: 8px;
}

.submenu-title {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  margin-bottom: 12px;
  letter-spacing: 1px;
  text-align: center;
}

.submenu-course-list {
  margin: 0;
  padding: 0 0 0 10px;
  list-style: disc;
}

.submenu-course-item {
  font-size: 15px;
  color: #1890ff;
  margin-bottom: 6px;
  cursor: pointer;
  transition: color 0.18s;
  text-align: left;
}

.submenu-course-item:hover {
  color: #ff9800;
}

.no-course {
  color: #aaa;
  font-size: 14px;
  margin-left: 10px;
  text-align: center;
}

/* 新增样式优化 */
.wide-block {
  max-width: 1200px;
  margin: 0 auto 32px auto;
  width: 100%;
}

.note-intro-section {
  width: 100vw;
  margin-bottom: 32px;
  padding-left: 0;
  padding-right: 0;
  /* 高级渐变背景，左深右浅 */
  background: linear-gradient(90deg, #5b8cfa 0%, #a3c8fd 50%, #fafdff 100%);
  /* 适当加点阴影提升层次感 */
  box-shadow: 0 2px 16px 0 rgba(91, 140, 250, 0.06);
}

.note-intro-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  border-radius: 0 0 12px 12px;
  padding: 48px 48px 40px 48px;
  width: 100%;
  box-sizing: border-box;
}

.note-intro-left {
  flex: 2 1 320px;
  min-width: 260px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(91, 140, 250, 0.08);
}

.note-intro-left h2 {
  color: #fff;
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 18px;
}

.note-intro-desc {
  color: #eaf3ff;
  font-size: 17px;
  margin-bottom: 12px;
}

.note-intro-list {
  list-style: disc inside;
  color: #eaf3ff;
  font-size: 15px;
  margin: 18px 0 0 0;
  padding: 0;
}

.note-intro-list li {
  margin-bottom: 6px;
}

.note-intro-btns {
  margin-top: 18px;
  /* 按钮风格更突出 */
  display: flex;
  gap: 12px;
}

.note-intro-btns .ant-btn-primary {
  background: #fff;
  color: #5b8cfa;
  border: none;
  font-weight: bold;
}

.note-intro-btns .ant-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: none;
  font-weight: bold;
}

.note-intro-right {
  flex: 1 1 320px;
  min-width: 200px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border-radius: 0 12px 12px 0;
}

.note-intro-right img {
  height: 90%;
  max-height: 95%;
  width: auto;
  max-width: 95%;
  object-fit: contain;
  border-radius: 16px;
  background: #f5f5f5;
  box-shadow: 0 2px 8px 0 rgba(91, 140, 250, 0.08);
  display: block;
  margin: 0 auto;
}

.system-info-section {
  width: 100vw;
  margin: 48px 0 0 0;
  padding-left: 0;
  padding-right: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  border-top: 1.5px solid #e5e6eb;
  border-bottom: 1.5px solid #e5e6eb;
  box-shadow: 0 -6px 16px -8px rgba(91, 140, 250, 0.08), /* 顶部阴影 */ 0 6px 16px -8px rgba(91, 140, 250, 0.08); /* 底部阴影 */
}

.system-info-content {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: stretch;
  width: 100vw;
  max-width: none;
  background: linear-gradient(180deg, #f6faff 0%, #eaf3ff 100%);
  border-radius: 0;
  box-shadow: 0 4px 24px 0 rgba(91, 140, 250, 0.06);
  padding: 0;
  box-sizing: border-box;
  margin: 0;
}

.system-info-block {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  background: transparent;
  padding: 48px 40px 40px 40px;
  border-right: 1.5px solid #e5e6eb;
}

.system-info-block:last-child {
  border-right: none;
}

.system-info-block h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #3a5b9a;
  margin-bottom: 18px;
}

.system-info-desc {
  color: #4b5e7a;
  font-size: 16px;
  margin-bottom: 10px;
}

.system-info-list {
  list-style: none;
  padding: 0;
  color: #444;
  font-size: 16px;
  margin: 0;
}

.system-info-list li {
  margin-bottom: 10px;
  font-size: 17px;
  display: flex;
  align-items: center;
}

.system-info-highlight {
  color: #5b8cfa;
  font-weight: bold;
  font-size: 1.15em;
  margin-left: 4px;
}

.system-info-highlight.green {
  color: #52c41a;
}

.system-info-highlight.orange {
  color: #faad14;
}

@media (max-width: 900px) {
  .system-info-content {
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .system-info-block {
    min-width: 0;
    width: 100%;
    align-items: flex-start;
    border-right: none;
    border-bottom: 1.5px solid #e5e6eb;
    padding: 32px 16px 24px 16px;
  }

  .system-info-block:last-child {
    border-bottom: none;
  }
}

/* 让区块撑满整个屏幕宽度 */
.full-width-block {
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  padding-left: 0;
  padding-right: 0;
}

/* 图片淡入淡出动画 */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.4s;
}

.fade-enter-from, .fade-leave-to {
  opacity: 0;
}

.note-intro-right {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-dots-vertical {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.img-switcher {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: #f5f5f5;
  box-shadow: 0 2px 8px 0 rgba(91, 140, 250, 0.08);
  display: block;
  margin: 0 auto;
  transition: transform 0.35s cubic-bezier(.4, 1.6, .6, 1), box-shadow 0.35s, filter 0.35s;
}

.switch-img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 36px 0 rgba(91, 140, 250, 0.18);
  filter: brightness(1.06);
}

/* 优化淡入淡出动画 */
.fade-img-enter-active, .fade-img-leave-active {
  transition: opacity 0.4s;
}

.fade-img-enter-from, .fade-img-leave-to {
  opacity: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d0d8e8;
  margin: 0;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(91, 140, 250, 0.08);
}

.dot.active {
  background: #5b8cfa;
  box-shadow: 0 0 0 3px #eaf3ff;
}

/* AI文档介绍板块样式 */
.ai-doc-intro-section {
  width: 100vw;
  margin-bottom: 32px;
  padding-left: 0;
  padding-right: 0;
  background: linear-gradient(90deg, #6a8dff 0%, #eaf3ff 100%);
  box-shadow: 0 2px 16px 0 rgba(106, 141, 255, 0.06);
}

.ai-doc-intro-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  border-radius: 0 0 12px 12px;
  padding: 48px 48px 40px 48px;
  width: 100%;
  box-sizing: border-box;
}

.ai-doc-intro-left {
  flex: 2 1 320px;
  min-width: 260px;
  color: #fff;
  text-shadow: 0 1px 8px rgba(106, 141, 255, 0.08);
}

.ai-doc-intro-left h2 {
  color: #fff;
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 18px;
}

.ai-doc-intro-desc {
  color: #eaf3ff;
  font-size: 17px;
  margin-bottom: 12px;
}

.ai-doc-intro-list {
  list-style: disc inside;
  color: #eaf3ff;
  font-size: 15px;
  margin: 18px 0 0 0;
  padding: 0;
}

.ai-doc-intro-list li {
  margin-bottom: 6px;
}

.ai-doc-intro-right {
  flex: 1 1 320px;
  min-width: 200px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.ai-doc-intro-right img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: #f5f5f5;
  box-shadow: 0 2px 8px 0 rgba(106, 141, 255, 0.08);
  display: block;
  margin: 0 auto;
}

/* 新版AI文档介绍板块样式 */
.ai-doc-intro-section-v2 {
  width: 100vw;
  margin-bottom: 36px;
  padding-left: 0;
  padding-right: 0;
  background: linear-gradient(180deg, #e3edff 0%, #ffffff 100%);
  box-shadow: 0 2px 24px 0 rgba(106, 141, 255, 0.08);
}

.ai-doc-intro-content-v2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
  border-radius: 0 0 18px 18px;
  padding: 56px 56px 48px 56px;
  width: 100%;
  box-sizing: border-box;
}

.ai-doc-intro-img-v2 {
  flex: 1 1 340px;
  min-width: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.ai-doc-intro-img-v2 img {
  max-height: 320px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 18px;
  background: #232b4d;
  box-shadow: 0 4px 24px 0 rgba(35, 43, 77, 0.18);
  display: block;
  margin: 0 auto;
  transition: transform 0.35s cubic-bezier(.4, 1.6, .6, 1), box-shadow 0.35s;
}

.ai-doc-intro-img-v2 img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 36px 0 rgba(35, 43, 77, 0.22);
  filter: brightness(1.06);
}

.ai-doc-intro-text-v2 {
  flex: 2 1 420px;
  min-width: 280px;
  color: #222;
  text-shadow: none;
}

.ai-doc-intro-text-v2 h2 {
  color: #3a5b9a;
  font-weight: 800;
  font-size: 2.2rem;
  margin-bottom: 22px;
  letter-spacing: 1px;
}

.ai-doc-intro-desc-v2 {
  color: #4b5e7a;
  font-size: 18px;
  margin-bottom: 18px;
  line-height: 1.7;
}

.ai-doc-intro-list-v2 {
  list-style: none;
  color: #3a5b9a;
  font-size: 16px;
  margin: 0;
  padding: 0;
}

.ai-doc-intro-list-v2 li {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  font-size: 17px;
}

.ai-doc-intro-list-v2 .icon {
  font-size: 1.2em;
  margin-right: 10px;
}

/* 强力全局背景色修正，彻底消除灰色间隙 */
html, body, #app, .ant-layout, .ant-layout-content {
  background: #fff !important;
}

/* 系统相关内容区块icon色块样式 */
.sysinfo-icon-block {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 2px 8px 0 rgba(91, 140, 250, 0.10);
}

.sysinfo-icon-block.blue {
  background: linear-gradient(135deg, #5b8cfa 60%, #7fc1fa 100%);
}

.sysinfo-icon-block.green {
  background: linear-gradient(135deg, #52c41a 60%, #a0e99c 100%);
}

.sysinfo-icon-block.orange {
  background: linear-gradient(135deg, #faad14 60%, #ffe7ba 100%);
}

.sysinfo-li-icon {
  color: #5b8cfa;
  font-size: 1.1em;
  margin-right: 8px;
  vertical-align: middle;
}

/* 页脚系统信息区块 */
.site-footer {
  width: 100vw;
  background: linear-gradient(180deg, #232b4d 0%, #2d1e4f 100%);
  color: #eaf3ff;
  padding: 38px 0 24px 0;
  font-size: 15px;
  margin-top: 0;
  letter-spacing: 0.2px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer-logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.footer-logo {
  color: #fff;
  font-weight: 800;
  font-size: 1.35em;
  letter-spacing: 2px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #b6c6e3;
  font-size: 15px;
}

.footer-divider {
  margin: 0 8px;
  color: #3a4a6a;
}

.footer-icp {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: #b6c6e3;
  font-size: 14px;
}

.footer-link {
  color: #b6c6e3;
  text-decoration: underline;
  transition: color 0.18s;
}

.footer-link:hover {
  color: #fff;
}

@media (max-width: 700px) {
  .footer-content {
    padding: 0 8px;
  }

  .footer-main {
    gap: 10px;
  }

  .footer-links, .footer-icp {
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    text-align: center;
  }
}

/* AI课堂之旅引导区块 */
.footer-cta-block {
  width: 100vw;
  background: linear-gradient(90deg, #eaf3ff 0%, #fafdff 100%);
  padding: 38px 0 18px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-cta-content {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.footer-cta-title {
  font-size: 2rem;
  font-weight: 800;
  color: #3a5b9a;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.footer-cta-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-cta-register-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

@media (max-width: 700px) {
  .footer-cta-content {
    padding: 0 8px;
    gap: 10px;
  }

  .footer-cta-title {
    font-size: 1.2rem;
  }

  .footer-cta-actions {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .footer-cta-register-row {
    justify-content: center;
    margin-top: -4px;
  }
}
/* 登录用户首页大搜索框 */
.main-search-block {
  width: 100vw;
  padding: 64px 0 48px 0;
  background: linear-gradient(180deg, #eaf3ff 0%, #fafdff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.main-search-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: #3a5b9a;
  margin-bottom: 32px;
  letter-spacing: 1px;
}
.main-search-input {
  width: 700px;
  max-width: 98vw;
  font-size: 1.25rem;
  border-radius: 36px !important;
  box-shadow: 0 4px 24px 0 rgba(91,140,250,0.08);
  background: #fff;
  margin-bottom: 32px;
  height: 60px !important;
  padding-left: 28px;
  padding-right: 28px;
  border: 1.5px solid #eaf3ff;
}
.main-search-actions {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.main-search-action-btn {
  min-width: 140px;
  font-size: 1.08rem;
  border-radius: 24px;
  background: #fafdff;
  color: #3a5b9a;
  border: 1.5px solid #eaf3ff;
  box-shadow: 0 2px 8px 0 rgba(91,140,250,0.06);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.main-search-action-btn:hover {
  background: #eaf3ff;
  color: #5b8cfa;
  box-shadow: 0 4px 16px 0 rgba(91,140,250,0.12);
}
.main-search-action-icon {
  font-size: 1.3em;
  vertical-align: middle;
  color: #5b8cfa;
}
@media (max-width: 700px) {
  .main-search-block {
    padding: 32px 0 24px 0;
  }
  .main-search-title {
    font-size: 1.1rem;
    margin-bottom: 18px;
  }
  .main-search-input {
    width: 98vw;
    font-size: 1rem;
  }
  .main-search-actions {
    gap: 10px;
  }
  .main-search-action-btn {
    min-width: 90px;
    font-size: 0.98rem;
    padding: 0 8px;
  }
}
.team-learning-section {
  width: 100vw;
  margin-bottom: 36px;
  padding-left: 0;
  padding-right: 0;
  background: linear-gradient(90deg, #fafdff 0%, #e3edff 100%);
  box-shadow: 0 2px 24px 0 rgba(91, 140, 250, 0.08);
}
.team-learning-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 40px;
  border-radius: 0 0 18px 18px;
  padding: 56px 56px 48px 56px;
  width: 100%;
  box-sizing: border-box;
}
.team-learning-img {
  flex: 1 1 340px;
  min-width: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.team-learning-text {
  flex: 2 1 420px;
  min-width: 280px;
  color: #222;
  text-shadow: none;
}
.team-learning-text h2 {
  color: #3a5b9a;
  font-weight: 800;
  font-size: 2.2rem;
  margin-bottom: 22px;
  letter-spacing: 1px;
}
.team-learning-desc {
  color: #4b5e7a;
  font-size: 18px;
  margin-bottom: 18px;
  line-height: 1.7;
}
.team-learning-list {
  list-style: none;
  color: #3a5b9a;
  font-size: 16px;
  margin: 0 0 18px 0;
  padding: 0;
}
.team-learning-list li {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  font-size: 17px;
}
</style>
